home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u2.d64
/
using 64 wedge.c
(
.txt
)
< prev
Wrap
Commodore BASIC
|
2007-02-04
|
10KB
|
287 lines
10 REM: PREPARED BY DUNCAN J MCRAE,
20 REM: WITH HELP FROM ARTICLES
30 REM: WRITTEN BY JIM BUTTERFIELD,
40 REM: THE 1541 USER'S MANUAL AND
50 REM: A SHORT PROGRAM FROM TPUG.
60 REM: I AM SURE SOMEONE WILL FIND
70 REM: ERRORS AND OMMISSIONS - IF THEY
80 REM: DO, I WOULD HIGHLY APPRECIATE
90 REM: A CALL AT (416)291-8785 OR
100 REM: (416)863-2504.
200 PRINT"[147]"TAB(9)" USE OF THE C-64 WEDGE [146]"
210 PRINT"HAS FOUR USES
220 [153]"(1) LOAD, RUN AND SAVE PROGRAMS
230 PRINT"(2) OBTAIN DIRECTORY WITHOUT
240 [153]"DISTURBING ALREADY LOADED
250 PRINT"FILE
260 [153]"(3) TRANSMIT DISK COMMANDS
270 PRINT"(4) CHECK DISK ERROR STATUS
280 [153]"TO LOAD TYPE: LOAD";[199](34);"C-64 WEDGE";[199](34);",8
290 PRINT"- AND RETURN [146] - THEN TYPE: ";CHR$(34);"RUN";CHR$(34)
300 PRINT"- AND RETURN [146]
310 [153]"THE WEDGE LOADS DOS 5.1 (DOS MEANS
320 PRINT"DISK OPERATING SYSTEM)
330 [153]"YOU MAY NOW TYPE ";[199](34);"NEW";[199](34);" OR RESTORE WAIT"
340 [153]"WITHOUT DISTURBING THE WEDGE"
350 [141]4000
400 [153]"WHENEVER I FORMAT A DISK (AS
410 PRINT"DESCRIBED LATER) I ALWAYS ENSURE
420 [153]"THAT THE FIRST TWO PROGRAMS ON THE
430 PRINT"DISK ARE THE WEDGE AND DOS 5.1"
440 PRINT"TO TRANSFER THE WEDGE, I LOAD THE
450 [153]"C-64 WEDGE AND SAVE IT AS ";[199](34);"WEDGE";[199](34)
460 [153]"IN THE NORMAL MANNER - BY USING
470 PRINT"A PROGRAM NAME OF ";CHR$(34);"WEDGE";CHR$(34);" IT IS
480 [153]"EASIER TO TYPE AND REMEMBER
490 PRINT"TO TRANSFER DOS 5.1 IT IS NECESSARY
500 [153]"EITHER TO USE A FILE COPIER PROGRAM
510 PRINT"OR TO LOAD AND RUN A MACHINE
520 [153]"LANGUAGE MONITOR SUCH AS SUPERMON64
530 PRINT" - TO LOAD TO THE MONITOR TYPE:
540 [153]"L";[199](34);"DOS 5.1";[199](34);",08 - AND RETURN WAIT
550 PRINT" - TO SAVE FROM THE MONITOR TO THE
560 [153]"NEW DISK TYPE:
570 PRINT"S";CHR$(34);"DOS 5.1";CHR$(34);",08,CC00,CF5A - AND RETURN [146]
580 [141]5000:[139]A$[178]"L"[137]200
600 [153]" RULES OF THE WEDGE WAIT"
610 [153]"COMMANDS MUST BE DIRECT - NOT IN A PROGRAM"
620 [153]"COMMANDS MUST START IN THE FIRST COLUMN OF THE SCREEN
630 PRINT"IT IS NOT NECESSARY TO ADD ,8
640 [153]"TO FILE NAMES WHEN USING THE
650 PRINT"WEDGE COMMANDS - THE COMPUTER
660 [153]"DEFAULTS TO THE DISK DRIVE
670 PRINT"FILE NAME NEED NOT BE IN QUOTES"
680 PRINT"DISK COMMANDS ARE PRECEEDED WITH
690 [153]"@ OR > - (I PREFER @)"
700 [153]"SOME PROGRAMS CONTAINING MACHINE
710 PRINT"LANGUAGE WILL NOT RUN WITH THE
720 [153]"WEDGE IN PLACE
730 GOSUB5000:IFA$="L"GOTO400
800 PRINT" (1) PROGRAM COMMANDS [146]"
810 PRINT"PROGRAM COMMANDS ARE:"
820 PRINT"/ - TO LOAD A PROGRAM"
830 PRINT"^ - TO LOAD AND RUN A PROGRAM"
840 PRINT"_ - TO SAVE A PROGRAM
850 [153]"% - TO LOAD A PROGRAM TO A"
860 [153]"SPECIFIC ADDRESS"
870 [153]"EXAMPLES OF THE PROGRAM
880 PRINT"COMMANDS ARE:"
890 PRINT"/PROGRAM = LOAD";CHR$(34);"PROGRAM";CHR$(34);",8"
900 PRINT"^PROGRAM = LOAD";CHR$(34);"PROGRAM";CHR$(34);",8 AND RUN
910 [153]"_PROGRAM = SAVE";[199](34);"PROGRAM";[199](34);",8
920 PRINT"%PROGRAM = LOAD";CHR$(34);"PROGRAM";CHR$(34);",8,1
930 [153]"TO RESAVE AN EXISTING PROGRAM, WHERE
940 PRINT"FOR EXAMPLE YOU HAVE MADE CHANGES,
950 [153]"THE COMMAND IS:
960 PRINT"_@0:PROGRAM - OR
970 [153]"_@:PROGRAM
980 GOSUB5000:IFA$="L"GOTO600
1000 PRINT"PATTERN MATCHING MAY BE USED - THE CHARACTERS ARE:"
1010 PRINT"? - TO MATCH A SINGLE CHARACTER
1020 [153]"* - TO MATCH A STREAM OF CHARACTERS
1030 PRINT"/N?T WILL LOAD NOT OR NUT
1040 [153]"/NOT* WILL LOAD NOTHING OR NOT OR
1050 PRINT"NOTICE
1060 [153]"IN ADDITION YOU MAY OBTAIN THE
1070 PRINT"DIRECTORY (AS DESCRIBED NEXT) MOVE
1080 [153]"THE CURSOR OPPOSITE THE PROGRAM
1090 PRINT"YOU WISH TO LOAD OR LOAD AND RUN,
1100 [153]"TYPE IN THE SYMBOL AND RETURN WAIT -CLOSECLOSECLOSECLOSE
1110 PRINT"THE PROGRAM WILL LOAD OR LOAD AND
1120 [153]"RUN - OTHER CHARACTERS ON THE LINE
1130 PRINT"CAN BE IGNORED
1140 [153]"THE NORMAL VERIFY COMMAND IS
1150 PRINT"USED WITH THE WEDGE - THAT IS
1160 [153]"TO SAY: VERIFY";[199](34);"PROGRAM";[199](34);",8"
1170 [141]5000:[139]A$[178]"L"[137]800
1200 [153]" (2) DIRECTORY WAIT"
1210 [153]"THE DIRECTORY IS OBTAINED BY TYPING
1220 PRINT"@$ (OR >$) FOLLOWED BY RETURN [146]
1230 [153]"THIS WILL NOT DISTURB A FILE
1240 PRINT"ALREADY LOADED
1250 [153]"PATTERN MATCHING MAY ALSO BE USED
1260 PRINT"- FOR EXAMPLE @$:D* WILL GIVE ONLY
1270 [153]"FILES STARTING WITH D
1280 PRINT"IF YOU WISH TO OBTAIN ONLY THE
1290 [153]"DISK NAME AND THE IDENTITY CODE
1300 PRINT"THEN THE COMMAND IS @$:
1310 [141]5000:[139]A$[178]"L"[137]1000
1400 [153]"IN THIS COMMAND AS WELL AS IN
1410 PRINT"SOME OF THE EXAMPLES OF THE DISK
1420 [153]"COMMANDS WHICH FOLLOW I HAVE
1430 PRINT"DROPPED A 0 FROM THE COMMAND -
1440 [153]"THIS MAY BE USED ONLY WHEN THERE
1450 PRINT"IS ONE SINGLE DRIVE IN USE - IF
1460 [153]"THERE ARE TWO DRIVES OR A DUAL
1470 PRINT"DRIVE THEN THE FIRST DRIVE IS
1480 [153]"DESIGNATED WITH 0 AND THE SECOND
1490 PRINT"DRIVE WITH 1
1500 [153]"FOR EXAMPLE, IF THERE IS A DUAL
1510 PRINT"DRIVE, THE COMMAND TO OBTAIN THE
1520 [153]"DIRECTORY FROM THE FIRST DRIVE
1530 PRINT"WOULD BE @$0 AND FROM THE SECOND
1540 [153]"DRIVE WOULD BE @$1
1550 GOSUB5000:IFA$="L"GOTO1200
1600 PRINT" (3) DISK COMMANDS [146]
1610 [153]"THE DISK COMMANDS INCLUDE FORMAT,
1620 PRINT"RENAME, SCRATCH, VALIDATE, INITIALIZE
1630 [153]"AND COPY
1640 PRINT"EACH COMMAND IS PRECEEDED BY @ OR >
1650 [153]"- IN THE FOLLOWING I SHALL USE @
1660 PRINT"IN ADDITION THERE IS THE DUPLICATE
1670 [153]"COMMAND FOR USE WHEN THERE IS A DUAL
1680 PRINT"DRIVE OR TWO DRIVES - THIS COMMAND
1690 [153]"COPIES A DISK FROM ONE DRIVE TO THE
1700 PRINT"OTHER - THE COMMAND IS:
1710 [153]"@D1=0
1720 PRINT"WHICH WILL COPY THE DISK IN DRIVE
1730 [153]"0 TO THE DISK IN DRIVE 1 - IT IS
1740 PRINT"PROBABLY BETTER TO USE ONE OF THE
1750 [153]"COPY PROGRAMS
1760 GOSUB5000:IFA$="L"GOTO1400
1800 PRINT" FORMAT [146] IS USED WHEN USING A DISK
1810 [153]"FOR THE FIRST TIME OR WHEN CLEARING
1820 PRINT"A DISK
1830 [153]"TO NEW A DISK:
1840 PRINT"@NEW0:DISK NAME,ID - OR"
1850 PRINT"@N0:DISK NAME,ID"
1860 PRINT"WHERE ";CHR$(34);"ID";CHR$(34);" IS ANY TWO UNIQUE
1870 [153]"CHARACTERS - NOTE THE 0 SHOULD
1880 PRINT"NOT BE DROPPED IN THIS COMMAND
1890 [153]"TO CLEAR A DISK:
1900 PRINT"@N0:0,00 FOLLOWED BY @N:
1910 [153]"TO CLEAR ONLY THE DIRECTORY:
1920 PRINT"@N:
1930 [153]"A DISK CANNOT BE USED UNTIL IT HAS
1940 PRINT"BEEN FORMATTED OR ";CHR$(34);"NEWED";CHR$(34)
1950 PRINT"(ANOTHER TERM COMMONLY USED FOR
1960 [153]"FORMAT OR NEW IS HEADER)"
1970 [141]5000:[139]A$[178]"L"[137]1600
2000 [153]" RENAME WAIT IS USED TO CHANGE THE NAME
2010 PRINT"OF A FILE ONCE IT IS IN THE
2020 [153]"DIRECTORY
2030 PRINT"TO RENAME:
2040 [153]"@RENAME0:NEWNAME=OLDNAME - OR
2050 PRINT"@R0:NEWNAME=OLDNAME - OR
2060 [153]"@R:NEWNAME=OLDNAME
2070 PRINT"RENAME WILL NOT WORK ON AN OPEN FILE
2080 [141]5000:[139]A$[178]"L"[137]1800
2200 [153]" SCRATCH WAIT REMOVES ONE OR MORE FILES
2210 PRINT"FROM A DISK AND FREES THE DIRECTORY
2220 [153]"AND DISK SPACE
2230 PRINT"TO SCRATCH:
2240 [153]"@SCRATCH0:FILENAME - OR
2250 PRINT"@S0:FILENAME - OR
2260 [153]"@S:FILENAME
2270 PRINT"PATTERN MATCHING MAY BE USED HOWEVER
2280 [153]"WATCH IT SINCE YOU MAY WELL SCRATCH
2290 PRINT"MORE FILES THAN YOU INTENDED
2300 [153]"IF YOU CALL FOR ERROR STATUS (I.E. @
2310 PRINT"AND RETURN [146]) THEN THE NUMBER OF
2320 [153]"FILES SCRATCHED WILL BE RETURNED
2330 PRINT"BY THE WAY, IF YOU HAVE SCRATCHED
2340 [153]"A FILE WHICH YOU DIDN'T MEAN TO
2350 PRINT"AND YOU HAVN'T SAVED ANOTHER
2360 [153]"FILE ON TOP OF IT, YOU CAN RECOVER
2370 PRINT"IT WITH THE PROGRAM ";CHR$(34);"REVIVE";CHR$(34)
2380 GOSUB5000:IFA$="L"GOTO2000
2400 PRINT" VALIDATE [146] WILL TIDY UP A DISK WHERE
2410 [153]"THERE HAVE BEEN A NUMBER OF SCRATCHES
2420 PRINT"AND NEW FILES ADDED - IT MAY GIVE YOU
2430 [153]"ADDITIONAL SPACE ON THE DISK - IT
2440 PRINT"WILL AND SHOULD BE USED TO REMOVE
2450 [153]"ANY INCOMPLETE FILES (I.E. WHERE
2460 PRINT"A * APPEARS BESIDE THE TYPE OF FILE
2470 [153]"ON THE DIRECTORY)
2480 PRINT"TO VALIDATE:
2490 [153]"@VALIDATE0 - OR
2500 PRINT"@V0 - OR
2510 [153]"@V
2520 PRINT"THIS COMMAND SHOULD NEVER BE USED
2530 [153]"WHEN THERE ARE RANDOM FILES ON THE
2540 PRINT"DISK AS IT WILL DE-ALLOCATE THEM
2550 [153]"I USE VALIDATE QUITE FREQUENTLY
2560 PRINT"WHEN I AM COPYING AND GENERALLY
2570 [153]"MUCKING AROUND WITH A DISK
2580 GOSUB5000:IFA$="L"GOTO2200
2600 PRINT" INITIALIZE [146] RETURNS THE DISK DRIVE
2610 [153]"TO THE SAME CONDITION AS WHEN IT WAS
2620 PRINT"POWERED UP - IT IS ALSO USED IF YOU
2630 [153]"ENCOUNTER ";[199](34);"DRIVE NOT READY";[199](34);" ERRORS"
2640 [153]"TO INITIALIZE:
2650 PRINT"@INITIALIZE0 - OR
2660 [153]"@I0 - OR
2670 PRINT"@I
2680 [141]5000:[139]A$[178]"L"[137]2400
2800 [153]" COPY WAIT ALLOWS YOU TO MAKE ANOTHER
2810 PRINT"COPY OF THE SAME FILE ON THE
2820 [153]"SAME DISK BUT UNDER A DIFFERENT NAME
2830 PRINT"TO COPY:
2840 [153]"@COPY0:NEWFILE=0:OLDFILE - OR
2850 PRINT"@C0:NEWFILE=0:OLDFILE - OR
2860 [153]"@C:NEWFILE=:OLDFILE - OR
2870 PRINT"@C:NEWFILE=OLDFILE
2880 [153]"YOU CAN ALSO STICK TOGETHER OR
2890 PRINT"CONCATENATE TWO TO FOUR FILES
2900 [153]"WITH THE FOLLOWING:
2910 PRINT"@C0:NEWFILE=0:OLDFILE1,0:OLDFILE2,
2920 [153]"0:OLDFILE3,0:OLDFILE4
2930 PRINT"I AM TOLD THAT CONCATENATION WILL
2940 [153]"WORK WITH PROGRAM FILES SO LONG
2950 PRINT"AS THE LINE NUMBERS DON'T CONFLICT
2960 [153]"HOWEVER IT HAS NEVER WORKED FOR ME
2970 PRINT"- I USE A MERGE PROGRAM INSTEAD
2980 [141]5000:[139]A$[178]"L"[137]2600
3000 [153]" (4) DISK STATUS WAIT"
3010 [153]"DISK STATUS IS OBTAINED BY TYPING
3020 PRINT"@ (OR >) FOLLOWED BY RETURN [146]"
3030 PRINT"IF NO ERROR, THEN THE MESSAGE WILL BE
3040 [153]"";[199](34);"00,OK,00,00";[199](34)
3050 [153]"THERE WILL BE A DIFFERENT MESSAGE IF"
3060 [153]"THERE IS AN ERROR OR, AS MENTIONED"
3070 [153]"EARLIER, IF THERE IS A SCRATCH
3080 PRINT"COMMAND"
3090 GOSUB5000:IFA$="L"GOTO2800
3200 PRINT"";TAB(14);" GOOD LUCK! [146]"
3210 GOSUB6000:IFA$="L"GOTO3000
3220 END
4000 PRINT" N=NEXT:P=PRINT [146]";
4010 A$="":GETA$:IFA$=""THEN4010
4020 IFA$="P"THENGOSUB7010
4030 IFA$="N"GOTO4050
4040 GOTO4010
4050 PRINT"[147]";
4060 RETURN
5000 PRINT" N=NEXT:L=LAST:P=PRINT [146]";
5010 A$="":GETA$:IFA$=""THEN5010
5020 IFA$="P"THENGOSUB7010
5030 IFA$="N"GOTO5060
5040 IFA$="L"GOTO5060
5050 GOTO5010
5060 PRINT"[147]";
5070 RETURN
6000 PRINT" N=END:L=LAST:P=PRINT [146]";
6010 GOTO5010
7000 REM SCREEN COPY
7010 SI$=CHR$(15):BS$=CHR$(8):PO$=CHR$(16)
7020 RV$=CHR$(18):RO$=CHR$(146):QT$=CHR$(34)
7030 MF$=CHR$(145):VR=PEEK(648)*256
7040 OPEN4,4:PRINT#4
7050 FORCL=0TO24:QF=0:AS$=MF$:FORRO=0TO39
7060 SC=PEEK(VR+40*CL+RO)
7070 IFSC=34THENQF=1-QF
7080 IFSC<>162THEN7110
7090 QF=1-QF:IFQF=1THENAS$=AS$+RV$+QT$:GOTO7170
7100 AS$=AS$+QT$+RO$:GOTO7170:GOTO7130
7110 IFQF=1AND(SC>=128)THENSC=SC-128:GOTO7130
7120 IFSC>=128THENSC=SC-128:RF=1:AS$=AS$+RV$
7130 IFSC<32ORSC>95THENAS=SC+64:GOTO7160
7140 IFSC>31ANDSC<64THENAS=SC:GOTO7160
7150 IFSC>63ANDSC<96THENAS=SC+32:GOTO7160
7160 AS$=AS$+CHR$(AS)
7170 IFRF=1THENAS$=AS$+RO$:RF=0
7180 NEXTRO
7190 IFQF=0THENPRINT#4,SI$PO$AS$:GOTO7210
7200 PRINT#4,SI$+PO$+AS$+QT$
7210 NEXTCL:PRINT#4,SI$:CLOSE4:RETURN